<template>
  <div>
    <el-carousel trigger="click" height="280px">
      <el-carousel-item v-for="item in images" :key="item.id">
        <img :src="item.img" alt="">
      </el-carousel-item>
    </el-carousel>
    <ul class="list clearfix">
      <li class="fl">
        <div class="list_head clearfix">
          <h1 class="fl">采购公告</h1>
          <router-link :to="{path:'/More',query:{title:'采购公告'}}">
            <span class="fr">更多</span>
          </router-link>
        </div>
        <ul class="list_info">
          <!-- <router-link :to="{path:'/Details',query:{title:'采购公告',value:this.messages.value}}"> -->
            <li class="clearfix" v-for="item in messages" @click="test(item.value)">
              <p class="fl p1">{{item.text}}</p>
              <p class="fr">{{item.timeStr}}</p>
            </li>
          <!-- </router-link> -->
        </ul>
      </li>
      <li class="fr">
        <div class="list_head clearfix">
          <h1 class="fl">网站公告</h1>
          <router-link :to="{path:'/More',query:{title:'网站公告'}}">
            <span class="fr">更多</span>
          </router-link>
        </div>
        <ul class="list_info">
            <li class="clearfix" v-for="item in website" @click="test1(item.value)">
              <p class="fl p1">{{item.text}}</p>
              <p class="fr">{{item.timeStr}}</p>
            </li>
        </ul>
      </li>
    </ul>
    <ul class="list clearfix">
      <li class="fl">
        <div class="list_head clearfix">
          <h1 class="fl">新闻政策</h1>
          <router-link :to="{path:'/More',query:{title:'新闻政策'}}">
            <span class="fr">更多</span>
          </router-link>
        </div>
        <ul class="list_info">
            <li class="clearfix" v-for="item in news" @click="test2(item.value)">
              <p class="fl p1">{{item.text}}</p>
              <p class="fr">{{item.timeStr}}</p>
            </li>
        </ul>
      </li>
      <li class="fr">
        <div class="list_head clearfix">
          <h1 class="fl">用户须知</h1>
          <router-link :to="{path:'/More',query:{title:'用户须知'}}">
            <span class="fr">更多</span>
          </router-link>
        </div>
        <ul class="list_info">
            <li class="clearfix" v-for="item in user" @click="test3(item.value)">
              <p class="fl p1">{{item.text}}</p>
              <p class="fr">{{item.timeStr}}</p>
            </li>
        </ul>
      </li>
    </ul>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        images: [{
            id: 1,
            img: 'http://www.nfsqtzs.com.cn/web/css/images/banner-02.jpg'
          },
          {
            id: 2,
            img: 'http://www.nfsqtzs.com.cn/web/css/images/APP_bg.png'
          }
        ],
        messages: [],
        website: [],
        news: [],
        user: [],
        messagesValue:[]
      }
    },
    mounted() {
      this.newp();
    },
    methods: {
      newp() {
        this.axios.get(this.lib.config.host.system + '/portal/query')
          .then((response) => {
            // console.log(response)
            this.messages = response.data[1];
            console.log(this.messages)            
            this.website = response.data[2];
            this.news = response.data[3];
            this.user = response.data[4];
          })
          .catch((error) => {
            console.log(error);
          });
      },
      test(value){
        window.open('/Details?id=' + value);
        //  this.$router.push({path:'/Details', query:{id: value}});
      },
      test1(value){
         window.open('/Details?id=' + value);
        //  this.$router.push({path:'/Details', query:{id: value}});
      },
      test2(value){
         window.open('/Details?id=' + value);
        //  this.$router.push({path:'/Details', query:{id: value}});
      },
      test3(value){
         window.open('/Details?id=' + value);
        //  this.$router.push({path:'/Details', query:{id: value}});
      }

    }
  }

</script>
<style>


</style>
